package cn.skyquant.quant4j.service.boot.model.economics.jinshi;

import cn.skyquant.quant4j.sdk.enums.CompareType;
import cn.skyquant.quant4j.sdk.enums.TradeDirection;

import javax.persistence.*;
import java.util.Objects;

@Entity
public class EconomicsCategoryImpact {

    @Id
    public int id;
    public int categoryId;
    @Column(name = "type")
    @Enumerated(EnumType.STRING)
    public CompareType type;
    public String symbol;
    @Column(name = "td")
    @Enumerated(EnumType.STRING)
    public TradeDirection td;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        EconomicsCategoryImpact that = (EconomicsCategoryImpact) o;
        return categoryId == that.categoryId &&
                type == that.type &&
                symbol.equals(that.symbol);
    }

    @Override
    public int hashCode() {
        return Objects.hash(categoryId, type, symbol);
    }
}
